#ifndef LIGHT_H
#define LIGHT_H

#include <QObject>

class Light : public QObject
{
    Q_OBJECT
    Q_PROPERTY(uint8_t m_value READ value WRITE setValue NOTIFY valueChanged)
public:
    explicit Light(QString name, QString channel, uint8_t value = 0, QObject *parent = nullptr);
    ~Light();

    QString channel() const;

    QString name() const;

    uint8_t value() const;
    void setValue(const uint8_t &value);

    QString getsData(); // 获取当前发送数据
    QString getDataString();// 获取当前亮度字符串

signals:
    void valueChanged(uint8_t newValue);
    void sendsData(const QString sData); // 发送数据


private:
    QString m_name;     // 光源名称
    QString m_channel;  // 光源连接的通道
    uint8_t m_value;    // 光源亮度(0~255)
    bool m_status;      // 光源状态 (开关)
};

#endif // LIGHT_H
